const path = require('path');

function resolve (dir) {
    return path.join(__dirname, '..', dir)
}

const config =  {
    entry : {
    	admin : './src/admin/main.js',
        adminLogin : './src/admin/login.js',
        touch : './src/touch/main.js',
        touchAuth : './src/touch/auth.js',
    },
    output : {
        filename : '[name].js',
        publicPath:  '/dist/',
        path : path.resolve(__dirname + '/public/dist'),
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                        css: 'vue-style-loader!css-loader',
                        less: 'vue-style-loader!css-loader!less-loader'
                    },
                    postLoaders: {
                        html: 'babel-loader'
                    }
                }
            },
            {
                test: /\.js$/,
                loader: 'babel-loader', exclude: /node_modules/
            },
            {
                test: /\.css$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'autoprefixer-loader'
                ]
            },
            {
                test: /\.less$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'less-loader'
                ]
            },
            {
                test: /\.scss$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'sass-loader?sourceMap'
                ]
            },
            { test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/, loader: 'url-loader?limit=8192'},
            { test: /\.(html|tpl)$/, loader: 'html-loader' }
        ]
    },
    devtool : 'inline-source-map',
    resolve: {
        alias: {
	      'vue$': 'vue/dist/vue.js'
	    },
        extensions: ['.js', '.vue'],
        modules : [
            path.resolve('./src'),
            path.resolve('./node_modules')
        ]
    },
}

const vuxLoader = require('vux-loader');

module.exports = vuxLoader.merge(config, {
  options: {},
  plugins: [{name: 'vux-ui'}]
})